aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/invoice/[id]/+layout.server.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-09-09 09:18:11 -0700
committerAdam Soltys <[email protected]>2025-09-10 10:46:50 -0700
commit3d5964347df0d34df8cad5846da843b626d6b3a6 (patch)
tree7f3fe06463caf252fc9bf1fae7c4ec67757421c2 /src/routes/(app)/invoice/[id]/+layout.server.ts
parent0e31af1d29097955bbcf5246f49ed36908dc16e3 (diff)
downloadcoinos-ui-3d5964347df0d34df8cad5846da843b626d6b3a6.tar.gz
coinos-ui-3d5964347df0d34df8cad5846da843b626d6b3a6.zip
check for user in invoice route
Diffstat (limited to 'src/routes/(app)/invoice/[id]/+layout.server.ts')
-rw-r--r--src/routes/(app)/invoice/[id]/+layout.server.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/routes/(app)/invoice/[id]/+layout.server.ts b/src/routes/(app)/invoice/[id]/+layout.server.ts
index d6ab979e..df8693be 100644
--- a/src/routes/(app)/invoice/[id]/+layout.server.ts
+++ b/src/routes/(app)/invoice/[id]/+layout.server.ts
@@ -19,7 +19,7 @@ export async function load({ cookies, depends, params, url, parent }) {
(!amount && (pending || received)) ||
(amount > 0 && (pending >= amount || received >= amount));
if (paid && !url.pathname.endsWith("paid")) {
- if (invoice.uid === user.id)
+ if (invoice.uid === user?.id)
redirect(307, `/invoice/${id}/paid` + (options ? "?options=true" : ""));
else redirect(307, `/pay/${subject.username}/${invoice.amount}`);
}
@@ -28,7 +28,7 @@ export async function load({ cookies, depends, params, url, parent }) {
if (
user &&
- invoice.uid !== user.id &&
+ invoice.uid !== user?.id &&
!(url.pathname.includes("tip") || url.pathname.includes("memo")) &&
!options
) {